import request from '@/utils/request'
import type {HospitalDoctorResponseData,HospitalDetail,LoginData,UserLoginResponseData,WxLoginResponseData,HospitalWorkerData} from './type'
enum API{
    // 获取医院详情
    HOSPITALDETAIL_URL='/hosp/hospital/',
    // 获取科室详情
    DEPARTMENTdETAIL_URL='/hosp/hospital/department/',
    // 获取验证码
    GETUSERCODE_URL='/sms/send/{phone}',
    // 登录
    LOGINUSER_URL='/user/login',
    // 获取微信扫码登录需要的参数
    WXLOGIN_URL='/user/weixin/getLoginParam',
    // 获取医院科室的预约挂号
    HOSPITALWORKER_URL='/hosp/hospital/auth/getBookingScheduleRule/',
    // 医生排班数据
    HOSPITALDOCTOR_URL='/hosp/hospital/auth/findScheduleList/'
}

export const reqHospitalDetail=(hoscode:string)=>request.get<any,HospitalDetail>(API.HOSPITALDETAIL_URL+hoscode)
export const reqDepartmentDetail=(hoscode:string)=>request.get<any>(API.DEPARTMENTdETAIL_URL+hoscode)
export const reqUserCode=(phone:string)=>request.get<any,any>(API.GETUSERCODE_URL+phone)
export const reqUserData=(loginData:LoginData)=>request.post<any,UserLoginResponseData>(API.LOGINUSER_URL,loginData)
export const reqWxLogin=(wxRedirectUri:string)=>request.get<any,WxLoginResponseData>(API.WXLOGIN_URL+`?wxRedirectUri=${wxRedirectUri}`)
export const reqHospitalWorker=(page:number,limit:number,hoscode:string,depcode:string)=>request.get<any,HospitalWorkerData>(API.HOSPITALWORKER_URL+`${page}/${limit}/${hoscode}/${depcode}`)
export const reqHospitalDoctor=(hoscode:string,depcode:string,workdate:string)=>request.get<any,HospitalDoctorResponseData>(API.HOSPITALDOCTOR_URL+`${hoscode}/${depcode}/${workdate}`)